package com.ruoyi.common.enums;

/**
 * 订单状态
 * 
 * @author ruoyi
 */
public enum OrderStatus
{
    PRE_PAY(1, "待支付"),
    IS_PAY(2, "已购买"),
    CANCEL(3, "已取消");

    private final Integer code;
    private final String info;

    OrderStatus(Integer code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }


    public static String getInfoByCode(Integer code){
        OrderStatus[] values = values();
        for (OrderStatus value : values) {
            if(value.getCode().equals(code)){
                return value.getInfo();
            }
        }
        return null;
    }
}
